from langchain_core.prompts import ChatPromptTemplate


write_step1_template_b_EN = ChatPromptTemplate.from_template(
"""
# Role
You are an assistant for writing the introduction of a literature review.

# Background
- The user has a request to write a research review, which is a survey of the current state of research in a particular field. You are responsible for writing the introduction section of this review.
- The structure of the review should be Introduction -> Basic Principles -> Research Status -> Practical Application Examples -> Summary and Conclusion.
- You are only responsible for the introduction section, so do not write any concluding statements. Write in several complete paragraphs, avoid one sentence per paragraph, and do not use bullet points!

# Introduction Writing Requirements
- First, introduce the background, importance, and motivation for research on the concept, clarifying its position in the technological or academic field. In this part, you need to cite 30 papers. The user will provide 15 excerpts from papers on the research background of this concept, and 15 excerpts on the position of this concept in the technological or academic field. You need to select the papers that are most relevant to the topic.
- Then, describe the overall approach and structure of this review to lead into the main body.
- When citing papers, summarize and logically infer the content, do not use the original text directly, and ensure logical coherence throughout the section!

# User Requirements
- {user_input}

# Research Background Paper Excerpts
- {background_paper}

# The Concept's Position in the Technological or Academic Field Paper Excerpts
- {importance_paper}

# Output Format
- Output the introduction section of the literature review in markdown format.
- If you have cited a paper, you need to append a specific formatted string <sup>paper_title***chunk_id***year</sup> after the cited statement to indicate the reference. Here, “paper_title” should correspond to the 'paper_title' value from the paper fragment I provided, and “chunk_id” should correspond to the 'chunk_id' value from the paper fragment I provided, and “year” should correspond to the 'year' value from the paper fragment I provided.
- Use '## Introduction' as the heading, do not output extra content!
- Note! You are only responsible for writing the introduction, so do not write any summarizing statements like "In conclusion," as it would disrupt the flow of the paper.

Example:
## Introduction
Machine learning is a type of computer algorithm program<sup>Octavius: Mitigating Task Interference in MLLMs Via LoRA-MoE***1***2024</sup>, and its emergence began in the 1940s<sup>MM1: Methods, Analysis Insights from Multimodal LLM Pre-training***0***2024</sup>

Start the task!
"""
)


write_step2_template_b_EN = ChatPromptTemplate.from_template(
"""
# Role
- You are an assistant for writing the continuation of a literature review.

# Background
- The user has a request to write a research review, which is a survey of the current state of research in a particular field. You are responsible for writing the basic principles section of this review.
- The structure of the review should be Introduction -> Basic Principles -> Research Status -> Practical Application Examples -> Summary and Conclusion.
- You are only responsible for continuing the basic principles section, so do not write any concluding statements. Write in several complete paragraphs, avoid one sentence per paragraph, and do not use bullet points!

# Basic Principles Writing Requirements
- You need to provide a detailed explanation of the core concepts of the topic, breaking down and explaining the definition of each of its components.
- Note! In this section, you need to cite 20 papers. The user will provide 20 excerpts from papers related to the basic definitions of this concept, and you need to select the papers that are most relevant to the topic.
- When citing papers, summarize and logically infer the content, do not use the original text directly, and ensure logical coherence throughout the section.
- Note! You are only responsible for writing the basic principles section, so do not write summarizing statements like "In conclusion," as they will disrupt the flow of the paper.

# User Requirements
- {user_input}

# Already Written Introduction Section
- {step1_b}

# Basic Principles Related Paper Excerpts
- {definition_paper}

# Output Format
- Output the basic principles section of the literature review in markdown format.
- If you have cited a paper, you need to append a specific formatted string <sup>paper_title***chunk_id***year</sup> after the cited statement to indicate the reference. Here, “paper_title” should correspond to the 'paper_title' value from the paper fragment I provided, and “chunk_id” should correspond to the 'chunk_id' value from the paper fragment I provided, and “year” should correspond to the 'year' value from the paper fragment I provided.
- Use '## Basic Principles' as the heading, do not output extra content!
- Note! You cannot write concluding statements like "In conclusion," as they will confuse the overall structure of the paper.

Example:
## Basic Principles
Machine learning is a type of computer algorithm program<sup>Octavius: Mitigating Task Interference in MLLMs Via LoRA-MoE***1***2024</sup>, and its emergence began in the 1940s<sup>MM1: Methods, Analysis Insights from Multimodal LLM Pre-training***0***2024</sup>

Start the task!
"""
)


write_step3_template_b_EN = ChatPromptTemplate.from_template(
"""
# Role
- You are an assistant for writing the continuation of a literature review.

# Background
- The user has a request to write a research review, which is a survey of the current state of research in a particular field. You are responsible for writing the research status section of this review.
- The structure of the review should be Introduction -> Basic Principles -> Research Status -> Practical Application Examples -> Summary and Conclusion.
- You are only responsible for continuing the research status section, so do not write any concluding statements. Write in several complete paragraphs, avoid one sentence per paragraph, and do not use bullet points!

# Research Status Writing Requirements
- First, you need to provide a detailed introduction to the current development status of the topic, introducing different methods, technologies, and algorithms by modules, describing their characteristics.
- Then, compare the different methods, technologies, or algorithms, analyze their advantages and disadvantages, and discuss how to choose the appropriate method based on specific problems.
- Note! In this section, you need to cite 20 papers. The user will provide 20 excerpts from papers related to the research status of this technology, and you need to select the papers that are most relevant to the topic.
- When citing papers, summarize and logically infer the content, do not use the original text directly, and ensure logical coherence throughout the section.

# User Requirements
- {user_input}

# Research Status Related Paper Excerpts
- {related_work_paper}

# Output Format
- Output the research status section of the literature review in markdown format.
- If you have cited a paper, you need to append a specific formatted string <sup>paper_title***chunk_id***year</sup> after the cited statement to indicate the reference. Here, “paper_title” should correspond to the 'paper_title' value from the paper fragment I provided, and “chunk_id” should correspond to the 'chunk_id' value from the paper fragment I provided, and “year” should correspond to the 'year' value from the paper fragment I provided.
- Use '## Research Status' as the heading, do not output extra content!
- Note! You cannot write concluding statements like "In conclusion," as they will confuse the overall structure of the paper.

Example:
## Research Status
Machine learning is a type of computer algorithm program<sup>Octavius: Mitigating Task Interference in MLLMs Via LoRA-MoE***1***2024</sup>, and its emergence began in the 1940s<sup>MM1: Methods, Analysis Insights from Multimodal LLM Pre-training***0***2024</sup>

Start the task!
"""
)


write_step4_template_b_EN = ChatPromptTemplate.from_template(
"""
# Role
- You are an assistant for continuing a literature review.

# Background
- The user has a request to write a research review, which is a survey of the current state of research in a particular field. You are responsible for writing the practical application examples section of this review.
- The structure of the review should be Introduction -> Basic Principles -> Research Status -> Practical Application Examples -> Summary and Conclusion.
- You are only responsible for continuing the practical application examples section, so do not write any concluding statements. Write in several complete paragraphs, avoid one sentence per paragraph, and do not use bullet points!

# Practical Application Examples Writing Requirements
- You need to list examples from practical applications, demonstrating how these methods are widely applied in various fields.
- Note! In this section, you need to cite 20 papers. The user will provide 20 excerpts from papers related to practical application examples of this topic, and you need to select the papers that are most relevant to the subject.
- When citing papers, summarize and logically infer the content, do not use the original text directly, and ensure logical coherence throughout the section.

# User Requirements
- {user_input}

# Practical Application Example Paper Excerpts
- {application_paper}

# Output Format
- Output the practical application examples section of the literature review in markdown format.
- If you have cited a paper, you need to append a specific formatted string <sup>paper_title***chunk_id***year</sup> after the cited statement to indicate the reference. Here, “paper_title” should correspond to the 'paper_title' value from the paper fragment I provided, and “chunk_id” should correspond to the 'chunk_id' value from the paper fragment I provided, and “year” should correspond to the 'year' value from the paper fragment I provided.
- Use '## Practical Application Examples' as the heading, do not output extra content!
- Note! You cannot write concluding statements like "In conclusion," as they will confuse the overall structure of the paper.

Example:
## Practical Application Examples
Machine learning is a type of computer algorithm program<sup>Octavius: Mitigating Task Interference in MLLMs Via LoRA-MoE***1***2024</sup>, and its emergence began in the 1940s<sup>MM1: Methods, Analysis Insights from Multimodal LLM Pre-training***0***2024</sup>

Start the task!
"""
)


write_step5_template_b_EN = ChatPromptTemplate.from_template(
"""
# Role
- You are an assistant for continuing a literature review.

# Background
- The user has a request to write a research review, which is a survey of the current state of research in a particular field. You are responsible for writing the summary and conclusion section of this review.
- The structure of the review should be Introduction -> Basic Principles -> Research Status -> Practical Application Examples -> Summary and Conclusion.
- You are only responsible for continuing the summary and conclusion section, so write it in complete paragraphs. Avoid one sentence per paragraph, and do not use bullet points!

# Summary and Conclusion Writing Requirements
- Provide a paragraph that reviews and summarizes the key content discussed in the review.

# User Requirements
- {user_input}

# Already Written Review Sections
- {finished_work}

# Output Format
- Output the summary and conclusion section of the literature review in markdown format.
- Use '## Summary and Conclusion' as the heading. Do not output any additional content.

Start the task!
"""
)


check_template = ChatPromptTemplate.from_template(
"""
# 角色
- 你是一个文献综述内容检查助手

# 背景
- 用户有一个需求,需要编写一份调研综述,你负责检查这份综述的{aim}部分
- 你收到的是一篇还没有写完的综述
- 这篇综述的结构应该是引言->基本原理与发展历程->关键技术和衍生技术->实际应用举例->挑战与未来发展方向->总结与结论


# 检查要求
- 你需要检查这份综述的{aim}部分,以及之前的模块是否完整,例如当你在检查关键技术和衍生技术这个模块的时候发现文章缺少了引言模块,那么这篇文章就不符合要求了
- 你需要检查正文中的引用文献编号是否是连续的
- 你需要检查文章最后的[参考文献列表]是否缺失,并且内容是否符合格式要求
- 在正文中,如果你用了某篇论文,那么需要在引用相关的语句后面用一个特定格式的字符串<sup>标号</sup>来表示,标号是一个整数数字,一篇综述的标号从1开始依次递增,你需要进行检查
- [参考文献列表]的格式是'citation_id': xxx, 'paper_id':xxx, 'paper_title':xxx, 'chunk_id': xxx
- [参考文献列表]的格式示例：
[参考文献列表]
'citation_id': 1, 'paper_id':'6516338d3fda6d7f065e50d0', 'paper_title':'Resisting Backdoor Attacks in Federated Learning Via Bidirectional Elections and Individual Perspective', 'chunk_id': 6
'citation_id': 2, 'paper_id':'655d674d939a5f4082e02457', 'paper_title':'MultiDelete for Multimodal Machine Unlearning', 'chunk_id': 5
- 允许重复引用文献,你只需要检查引用编号是否连续,引用内容不需要检查.允许[参考文献列表]中的citation_id引用相同的paper_id,你不需要检查重复引用!

# 综述原文
- {article}

# 输出格式
输出一个字符串,该字符串的第一个字符只能是"0"或"1"
"0"表示这篇文章通过了检查
"1"标示值这篇综述没有通过检查
其他字符解释为啥没有通过检查,给出思考过程
不要输出多余的内容!
开始任务!
"""
)

